<!DOCTYPE html>
<html lang="en">
	<head>
		<meta charset="UTF-8" />
		<meta http-equiv="X-UA-Compatible" content="IE=edge" />
		<meta name="viewport" content="width=device-width, initial-scale=1.0" />
		<title>Document</title>
	</head>
	<body>
		<h1>index</h1>

		<button id="btn">请求</button>
		<script src="./axios.js"></script>
		<script>
			// console.log('', _.debounce())
			// var debounced = _.debounce(() => {
			// 	console.log('11111')
			// }, 250)

			// 防抖函数
			function debounce(func, wait) {
				let timeout
				return function () {
					if (timeout) clearTimeout(timeout)
					timeout = setTimeout(() => {
						func()
					}, wait)
				}
			}

			btn.onclick = debounce(() => {
				axios.get('/api/allCount').then((res) => {
					console.log('res:', res)
				})
			}, 300)

			// axios.create({
			// 	timeout: '40000'
			// })

			axios
				.get('/api/del', {
					params: {
						ids: [1, 2, 3, 4, 5]
					}
				})
				.then((res) => {})
		</script>
	</body>
</html>
